package koneksi;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

public class CreateTableKonsumen {
    public static void main(String[] args) {
        try {
            Connection conn = Koneksi.open();
            Statement state = conn.createStatement();

            String query="create table dataKonsumen(no_pelanggan varchar(20) constraint dataKonsumen_pk primary key,"
                    + "no_barang varchar(20) constraint dataKonsumen_fk references data_barang(no_barang),"
                    + "nama_pengirim varchar(20),"
                    + " noTelp_pengirim varchar(20),"
                    + " alamat_pengirim varchar(20),"
                    + " nama_penerima varchar(20),"
                    + " noTelp_penerima varchar(20),"
                    + " alamat_penerima varchar(20))";
            state.executeUpdate(query);
            System.out.println("tabel data konsumen is created");

        } catch (SQLException ex) {
            Logger.getLogger(CreateTableKonsumen.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
